<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class SendWechatTemplateMsg implements ShouldQueue
{
    use InteractsWithQueue, Queueable, SerializesModels;

    private $func;
    private $params;

    /**
     * Create a new job instance.
     *
     * @param $func
     * @param $params
     */
    public function __construct($func, $params)
    {
        $this->func = $func;
        $this->params = $params;
    }

    /**
     * Execute the job.
     * @return void
     * @throws Exception
     */
    public function handle()
    {
        call_user_func_array($this->func, $this->params);
    }
}
